package task

import (
	"push_course/src/entity"
	"time"
)

func CourseTask() *entity.Task {
	return &entity.Task{
		Comment: `
- 早上推送触发器
	- 7.20  推送早上课表
	- 12.20 推送下午课表
	- 18.20 推送晚上课表` ,
		Callback: func(t time.Time,now string) {
			weekDay := int(t.Weekday())
			/*
				const (
				    Sunday    0
				    Monday    1
				    Tuesday   2
				    Wednesday 3
				    Thursday  4
				    Friday    5
				    Saturday  6
				)
			*/
			// 星期五以后 和星期日不推送
			if weekDay > 5 || weekDay == 0 {
				return
			}

			// 整点 7.20 13.20 18.20
			weekDay--
			switch now {
			case "7:20:0":
				pusher.PushInMornCourseFF(weekDay)
				pusher.PushInMornCourseYY(weekDay)

			case "12:20:0":
				pusher.PushInAfternoonCourseFF(weekDay)
				pusher.PushInAfternoonCourseYY(weekDay)

			case "18:20:0":
				pusher.PushInEvenCourseFF(weekDay)
				pusher.PushInEvenCourseYY(weekDay)
			}

		},
	}
}
